Skip to content

perf: lazy-load book covers in the search results - #16

Merged
Garfield-fr merged 1 commit into
rero:mainfrom
Garfield-fr:perf/lazy-book-covers
Nov 24, 2026
Merged

Garfield-fr merged 1 commit into
rero:mainfrom
Garfield-fr:perf/lazy-book-covers

Conversation

@Garfield-fr

Copy link
Copy Markdown
Collaborator

Summary

The book search results show up to 36 books per page (9 by default), and every cover image was downloaded as soon as the page rendered, including those far below the fold.

The cover <img> in book.ts now has:

  • loading="lazy": the browser only fetches covers that are near the viewport.
  • decoding="async": image decoding does not block rendering.

These are native browser attributes, with no extra code or dependency.

The cover on the book detail page and the sidebar and login logos are unchanged. They are visible as soon as the page opens, so lazy-loading them would only delay them.

Checks

  • pnpm format:check, pnpm lint, pnpm build: pass
  • pnpm test: 22/22 tests pass
  • Manual: search for books with 36 rows per page, and check in the Network tab that covers load while scrolling

🤖 Generated with Claude Code

The results grid shows up to 36 books per page, and every cover was
downloaded as soon as the page rendered. Covers now use native
loading="lazy", so the browser only fetches those near the viewport,
and decoding="async" so decoding does not block rendering.

The cover on the book detail page and the logo stay eager: they are
visible as soon as the page opens.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e846f6a2-6f44-46f2-a1d9-16ab036810cb
Commits

Reviewing files that changed from the base of the PR and between e1f7fbb and 15b7065.

Files selected for processing: 1

  • src/app/features/books/book.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Garfield-fr
Garfield-fr merged commit 6a7e0fc into rero:main Nov 24, 2026
3 checks passed
@Garfield-fr
Garfield-fr deleted the perf/lazy-book-covers branch November 24, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant